package com.zlz.server.utils;

import com.zlz.server.pojo.Admin;
import org.springframework.security.core.context.SecurityContextHolder;

/**
 * @author: zlz
 * @date: 2021/1/29 21:03
 * @description: 当前操作者工具类
 * @since: JDK1.8
 */
public class AdminUtil {
    /**
     * 获取当前操作者
     *
     * @return 当前操作者
     */
    public static Admin getCurrentAdmin() {
        return ((Admin) SecurityContextHolder.getContext().getAuthentication().getPrincipal());
    }
}
